﻿Public Class frmManProtocolo

    Private Protocolo As New BEprotocolos
    'Private ptitulo As String
    Private codPatrocinador As Integer
    Private nomPatrocinador As String
    Private codInvestigador As Integer
    ''Private nomInvestigador As String

    Public Property _protocolo()
        Get
            Return Protocolo
        End Get
        Set(ByVal value)
            Me.Protocolo = Protocolo
        End Set
    End Property

    Public Property _codInvestigador()
        Get
            Return codInvestigador
        End Get
        Set(ByVal value)
            Me.codInvestigador = value
        End Set
    End Property

    Public Property _nomInvestigador()
        Get
            Return Me.txtInvestigador.Text
        End Get
        Set(ByVal value)
            Me.txtInvestigador.Text = value
        End Set
    End Property



    Private Property _codPatrocinador()
        Get
            Return codPatrocinador
        End Get
        Set(ByVal value)
            Me.codPatrocinador = value
        End Set
    End Property

    Private Property _nomPatrocinador()
        Get
            Return Me.txtPatrocinador.Text
        End Get
        Set(ByVal value)
            txtPatrocinador.Text = value
        End Set
    End Property


    Private Sub btnBuscarResponsable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscarResponsable.Click
        frmMedicos.ShowDialog()
        Me._codInvestigador = frmMedicos._codMedico
        Me.txtInvestigador.Text = frmMedicos._nomMedico

    End Sub


    Private Sub btnBuscarPatrocinador_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscarPatrocinador.Click
        frmPatrocinador.ShowDialog()
        Me._codPatrocinador = frmPatrocinador._codPatrocinador
        Me.txtPatrocinador.Text = frmPatrocinador._nomPatrocinador
    End Sub

    Private Function valida()
        Return True

    End Function

    Private Sub btnGuardar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuardar.Click

        If Valida() Then
            Dim Protocolo As New BLprotocolo

            Protocolo.Guardar(Me._codPatrocinador, Me.txtTitulo.Text, Me.rbtProspectivo.Checked, Me.rbtRetrospectivo.Checked, _
                              Me.dtpFecIni.Value, Me.dtpFecFin.Value, Me._codInvestigador, Me.txtObs.Text, _
                              Integer.Parse(Me.txtMax.Text), Integer.Parse(Me.txtMin.Text), Me.cmbEstado.SelectedValue)

        End If
    End Sub

    Private Sub frmManProtocolo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'BTTbdDataSet1.estado_protocolo' table. You can move, or remove it, as needed.
        Me.Estado_protocoloTableAdapter.Fill(Me.BTTbdDataSet1.estado_protocolo)

    End Sub
End Class